<?php
include('../../include/functions.inc.php');
$intCiclo = getParam('CICLO');
$intCarrera = getParam('CARRERA');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Re-calendarizaci&oacute;n de cargos</title>
        <link href="../../bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
        <link href="../../css/ContentStyle.css" rel="stylesheet" type="text/css" />
        <link href="../../js/protocalendar/datepicker.css" rel="stylesheet" type="text/css" />
        <link href="../../css/tableorderer.css" rel="stylesheet" type="text/css" />
        <link href="../../js/dialog/dialog.2.0.css" rel="stylesheet" type="text/css" />
        <script src="../../js/prototype.js" type="text/javascript"></script>
        <script src="../../js/jquery.js" type="text/javascript"></script>
        <script>jQuery.noConflict();</script>
        <script src="../../bootstrap/js/bootstrap.js"></script>
        <script src="../../js/jsvalidate.js" type="text/javascript"></script>
        <script src="../../js/protocalendar/prototype-date-extensions.js" type="text/javascript"></script>
        <script src="../../js/protocalendar/datepicker.js"  type="text/javascript"></script>
        <script src="../../js/TableOrderer.js" type="text/javascript"></script>
        <script src="../../js/dialog/dialog.2.0.js" type="text/javascript"></script>
        <script src="../../js/include.js" type="text/javascript"></script>
        <style type="text/css">
            input,
            textarea{
                width: 300px;
            }
            select{
                width: 314px;
            }
        </style>    
    </head>
    <body>
        <script type="text/javascript" language="javascript">
            function getResultado() {
                jQuery.ajax({
                    url: "cargos.php",
                    data : jQuery("#ASIGNACION").serialize(),
                    type: "POST",
                    success: function(data) {
                        jQuery("#tdResultado").html(data);
                    }
                });
            }
            
            jQuery(function() {
                jQuery("#CICLO").change( function(){
                    getResultado();
                });
                jQuery("#CARRERA").change( function(){
                    getResultado();
                });
                getResultado();
            });
        </script>
        <div id="tabs">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a>Re-calendarización de cargos</a>
                </li>
            </ul>
        </div>
        <div id="tabs-cont">
            <div id="rsvErrors"></div>
            <form id="ASIGNACION" name="ASIGNACION" method="POST" action="data.php?operation=save">
                <table class=""  width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th scope="col" width="50%"></th>
                        <th scope="col" width="50%"><input type="submit" name="cmdOk" id="cmdOk" class="btn btn-info" value="Guardar" /></th>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="10%">CICLO</td>
                                    <td width="90%">
                                        <select name="CICLO" id="CICLO">
                                            <option value="0">&nbsp;</option>
                                            <?php
                                            $strQuery ="SELECT  *
                                                        FROM    cllg_college_cycle";
                                            $db->query($strQuery);
                                            while( $arrTMP = $db->fetch_assoc() ) {
                                                $strSelected = ($intCiclo == $arrTMP['CODE']) ? 'selected="selected"' : '';
                                                ?>
                                                <option value="<?php print $arrTMP['CODE']; ?>" <?php print $strSelected; ?>><?php print $arrTMP['CODE']; ?></option>
                                                <?php
                                            }
                                            $db->free_result($db->query_id);
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>CARRERA</td>
                                    <td>
                                        <select name="CARRERA" id="CARRERA">
                                            <option value="0">&nbsp;</option>
                                            <?php
                                            $strQuery ="SELECT  *
                                                        FROM    cllg_career";
                                            $db->query($strQuery);
                                            while( $arrTMP = $db->fetch_assoc() ) {
                                                $strSelected = ($intCarrera == $arrTMP['ID']) ? 'selected="selected"' : '';
                                                ?>
                                                <option value="<?php print $arrTMP['ID']; ?>" <?php print $strSelected; ?>><?php print $arrTMP['NAME']; ?></option>
                                                <?php
                                            }
                                            $db->free_result($db->query_id);
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>MESES A CORRER</td>
                                    <td>
                                        <select required="required" name="MESES" id="MESES">
                                            <option>--Seleccione meses--</option>
                                            <?php
                                            $i = 1;
                                            while ($i <= 12){
                                                ?>
                                                <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
                                                <?php $i++;
                                            }
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2"><hr></td>
                    </tr>
                    <tr>
                        <td colspan="2" id="tdResultado">&nbsp;</td>
                    </tr>
                    <tr>
                        <td colspan="2"><input type="hidden" name="operation" id="operation" value="save" /></td>
                    </tr>
                </table>
            </form>
        </div>
    </body>
</html>